/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EliminarSala.java
 *
 * Created on 13/01/2011, 10:15:10 AM
 */

package IGU;

import javax.swing.JFrame;
import logica.FuncionesGUI;

/**
 *
 * @author Cristian
 */
public class EliminarSala extends javax.swing.JFrame {
    private JFrame ventanaPadre;

    /** Creates new form EliminarSala */
    public EliminarSala() {
        initComponents();
        initMyOwnComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        MainNickname2 = new javax.swing.JLabel();
        jBCancelar = new javax.swing.JButton();
        jBAceptar = new javax.swing.JButton();
        jCBListaSucursales = new javax.swing.JComboBox();
        MainNickname3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        MainNickname4 = new javax.swing.JLabel();
        jCBSala = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jPanel3.setBackground(new java.awt.Color(51, 51, 51));
        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setLayout(null);

        MainNickname2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        MainNickname2.setForeground(new java.awt.Color(255, 255, 255));
        MainNickname2.setText("Eliminar Una Sala de una Sucursal");
        MainNickname2.setName("MainNickname2"); // NOI18N
        jPanel3.add(MainNickname2);
        MainNickname2.setBounds(120, 30, 250, 24);

        jBCancelar.setText("Cancelar");
        jBCancelar.setName("jBCancelar"); // NOI18N
        jBCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBCancelarActionPerformed(evt);
            }
        });
        jPanel3.add(jBCancelar);
        jBCancelar.setBounds(270, 190, 110, 23);

        jBAceptar.setText("Aceptar");
        jBAceptar.setName("jBAceptar"); // NOI18N
        jBAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAceptarActionPerformed(evt);
            }
        });
        jPanel3.add(jBAceptar);
        jBAceptar.setBounds(80, 190, 110, 23);

        jCBListaSucursales.setName("jCBListaSucursales"); // NOI18N
        jCBListaSucursales.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBListaSucursalesActionPerformed(evt);
            }
        });
        jPanel3.add(jCBListaSucursales);
        jCBListaSucursales.setBounds(180, 100, 230, 20);

        MainNickname3.setForeground(new java.awt.Color(255, 255, 255));
        MainNickname3.setText("Seleccione sala (ID):");
        MainNickname3.setName("MainNickname3"); // NOI18N
        jPanel3.add(MainNickname3);
        MainNickname3.setBounds(40, 140, 100, 24);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IGU/imagen/DeleteG.png"))); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        jPanel3.add(jLabel1);
        jLabel1.setBounds(40, 30, 60, 60);

        MainNickname4.setForeground(new java.awt.Color(255, 255, 255));
        MainNickname4.setText("Sucursal:");
        MainNickname4.setName("MainNickname4"); // NOI18N
        jPanel3.add(MainNickname4);
        MainNickname4.setBounds(100, 100, 60, 24);

        jCBSala.setName("jCBSala"); // NOI18N
        jPanel3.add(jCBSala);
        jCBSala.setBounds(180, 140, 140, 20);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCancelarActionPerformed
        FuncionesGUI.habilitarVentana(this.ventanaPadre, true, true);
        this.dispose();
        // TODO add your handling code here:
}//GEN-LAST:event_jBCancelarActionPerformed
    private void initMyOwnComponents()
    {

        FuncionesGUI.inicializarCombo (jCBListaSucursales, "Seleccione un Cine");
        FuncionesGUI.cargarListaCinesEnCombo(jCBListaSucursales, false);
        FuncionesGUI.inicializarCombo (jCBSala, "Seleccione una Sala");
    }
    private void jBAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAceptarActionPerformed
        FuncionesGUI.EliminarSala(jCBListaSucursales.getSelectedIndex()-1,jCBSala.getSelectedIndex()-1);

        // TODO add your handling code here:
        FuncionesGUI.habilitarVentana(this.ventanaPadre, true, true);
        this.dispose();
}//GEN-LAST:event_jBAceptarActionPerformed

    private void jCBListaSucursalesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBListaSucursalesActionPerformed

        FuncionesGUI.cargarListaSalasEnCombo(jCBListaSucursales.getSelectedIndex()-1,jCBSala,false);


        // TODO add your handling code here:
    }//GEN-LAST:event_jCBListaSucursalesActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
 FuncionesGUI.habilitarVentana(this.ventanaPadre, true, true);
        this.dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowClosing
         public void setVentanaPadre(JFrame ventanaPadre)
    {
        this.ventanaPadre = ventanaPadre;
    }

    public JFrame getVentanaPadre() {
        return ventanaPadre;
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new EliminarSala().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel MainNickname;
    private javax.swing.JLabel MainNickname1;
    private javax.swing.JLabel MainNickname2;
    private javax.swing.JLabel MainNickname3;
    private javax.swing.JLabel MainNickname4;
    private javax.swing.JButton jBAceptar;
    private javax.swing.JButton jBCancelar;
    private javax.swing.JComboBox jCBListaSucursales;
    private javax.swing.JComboBox jCBSala;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    // End of variables declaration//GEN-END:variables

}
